<?php 
	//print_r($listNote);
    $parentid = $this->Mitq_category->getParentidById($catid);
    $parentid = $parentid['parentid'];

    function findrt($listcategory,$parentid=0){
        $myarr = '';
        if($parentid==0){
            return 0;
        }else{
            foreach($listcategory as $key=> $value){
                if($parentid==$value['id']){
                    $myarr.=$value['id'].'/';
                    $myarr.=findrt($listcategory,$value['parentid']);
                    break;
                }
            }
            return $myarr;
        }
    }
    $myarr = findrt($listcategory,$infoNote['category-id']);
    $myarr  = explode('/',$myarr);
    foreach ($myarr as $key => $value) {
    	$breatcame[$key] = $this->model_frontend->getCategoryByID($value);
    }
    foreach ($breatcame as $key => $value) {
    	if(!empty($breatcame[$key]['alias'])){
    	$breatcame[$key]['link'] = $value['alias'].'-'.$value['type_category'].'-'.$value['id'].'.html';
    	}else{
    		$breatcame[$key]['link']='#';
    		$breatcame[$key]['title']='Trang Chủ';
    	}
    }
    sort($breatcame);
?>
<section class="content">
	<div class="content_top">
    		<div class="breadcrumb">
	    		<ul>
            <?php foreach($breatcame as $key=>$value){
            ?>
            <li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
                <a rel="nofollow" href="<?php echo $value['link']?>" title="<?php echo $value['title']?>" itemprop="url"> <span itemprop="title"> <?php echo $value['title']?> </span></a>
            </li>
            <li class="spacebar">»</li>
            <?php }?>
            </div>
    	    <!-- breadcrumb -->
    		<div class="clear"></div>
    	</div>
	<section class="slide-detail">
		<div id="owl-demo-detail-note" class="owl-carousel owl-theme">
		<?php if(isset($listNote) && count($listNote)){foreach ($listNote as $key => $value) {?>
			<div class="item">
				<figure class='same-note'>
					<img src="<?php echo $value['image']?>" alt="<?php echo $value['title']?>"/>
					<figcaption class='title-same-note'><a href=""><?php echo $value['title']?></a></figcaption>
				</figure>
			</div>
		<?php 	}		}	?>	
		</div>
		<div class="customNavigation">
		  <a class="btn prev">Previous</a>
		  <a class="btn next">Next</a>
		  <a class="btn play">Autoplay</a>
		  <a class="btn stop">Stop</a>
		</div>
	</section>
	<section class="detail-note">
		<h1 class='title-Note'>
			<?php echo $infoNote['title'];?>
		</h1>
		<figure>
			<img src='<?php echo $infoNote['image']; ?>' alt='<?php echo $infoNote['title'];?>'/>
		</figure>
		<h2 class='description-Note'>
			<?php echo $infoNote['description'];?>
		</h2>
		<article>
			<?php echo $infoNote['content'];?>
		</article>
		<i>tác giả - nguồn:<?php echo $created; ?></i>
	</section>
	<aside class="side-bar">
		<div class="rightsidebar">
			<h2>Danh Mục Bài Viết</h2>
			<ul>
				<?php if(!empty($listcategory)){foreach ($listcategory as $key => $value) {?>
				<li><a href="<?php echo $value['link'];?>"> <?php echo $value['title']?></a></li>
				<?php    }		}	?>
			</ul>
		<div class="clear"></div>	
	</aside>
	<section class="clear"></section>
</section>
<script type="text/javascript">
$(document).ready(function() {
 
  var owl = $("#owl-demo-detail-note");
 
  owl.owlCarousel({
      items : 3, //10 items above 1000px browser width
      itemsDesktop : [1000,5], //5 items between 1000px and 901px
      itemsDesktopSmall : [900,3], // betweem 900px and 601px
      itemsTablet: [600,2], //2 items between 600 and 0
      itemsMobile : false // itemsMobile disabled - inherit from itemsTablet option
  });
 
  // Custom Navigation Events
  $(".next").click(function(){
    owl.trigger('owl.next');
  })
  $(".prev").click(function(){
    owl.trigger('owl.prev');
  })
  $(".play").click(function(){
    owl.trigger('owl.play',1000); //owl.play event accept autoPlay speed as second parameter
  })
  $(".stop").click(function(){
    owl.trigger('owl.stop');
  })
 
});
</script>